# 2024/1/10 19:07 HFL
import unittest
from HTMLTestRunner import HTMLTestRunner

from common.changefilename import fname

# 创建用例池
suite = unittest.TestSuite()
# 加载测试用例
case_dir = r'D:\Python_学习\Unitest_Demo\test_case'
disc = unittest.defaultTestLoader.discover(case_dir,pattern='test*.py', top_level_dir=None)
for i in disc:
    for t_suite in i:
        suite.addTest(t_suite)

name = fname('.html')
fpath= "../report/"+name

with open(fpath,'wb+') as file:
    runner = HTMLTestRunner(stream=file,verbosity=1, title='tp自动化测试', description='全量测试模块')
    runner.run(suite)